package com.prothink.controller;

import com.prothink.entity.FenyeNode;
import com.prothink.entity.JsComment;
import com.prothink.service.CommentlistService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @BelongsProject: siyun2
 * @BelongsPackage: com.prothink.controller
 * @Author: Jin
 * @CreateTime: 2022-11-28  16:41
 * @Description: TODO
 */
@Controller
@RequestMapping("/JsComment")
@CrossOrigin
public class CommentlistController {
    @Autowired
    private CommentlistService commentlistService;
//    查看评论列表
    /**
     * @
     * @author Jin
     * @date 2022/12/1 11:51
     * @param [jsComment]
     * @return FenyeNode<JsComment>
     */
    @ResponseBody
    @GetMapping("/getCommentlist")
    public FenyeNode<JsComment> getCommentlist(JsComment jsComment){
        FenyeNode<JsComment> commentlist = commentlistService.getCommentlist(jsComment);
        System.out.println(commentlist);
        return commentlist;
    }
//    查看历史评论人数
    /**
     * @
     * @author Jin
     * @date 2022/12/1 11:51
     * @param [integer]
     * @return int
     */
    @ResponseBody
    @GetMapping("/getCommenttime")
    public int  getCommenttime(Integer integer){
        int getcommentime = commentlistService.getcommentime(integer);
        System.out.println("getcommentime: "+getcommentime);
        return getcommentime;
    }
    //  查看今日评论人数
    /**
     * @
     * @author Jin
     * @date 2022/12/1 11:51
     * @param [integer]
     * @return int
     */
    @ResponseBody
    @GetMapping("/getcommentnewdate")
    public int getcommentnewdate(Integer integer){
        int getcommentnewdate = commentlistService.getcommentnewdate(integer);
        System.out.println("getcommentnewdate: "+getcommentnewdate);
        return getcommentnewdate;
    }
    //  查看今日评论次数
    /**
     * @
     * @author Jin
     * @date 2022/12/1 11:52
     * @param [integer]
     * @return int
     */
    @ResponseBody
    @GetMapping("/getcommentnewdatenumber")
    public int getcommentnewdatenumber(Integer integer){
        int getcommentnewdatenumber = commentlistService.getcommentnewdatenumber(integer);
        System.out.println("getcommentnewdatenumber: "+getcommentnewdatenumber);
        return getcommentnewdatenumber;
    }
    /**
     * @ 改成拦截状态
     * @author Jin
     * @date 2022/12/2 16:38
     * @param [id]
     * @return int
     */
    @ResponseBody
    @GetMapping("/updcommentblock")
    public int updcommentblock(Integer id){

        int i = commentlistService.updcommentblock(id);
        return i;
    }
    /**
     * @改成通过状态
     * @author Jin
     * @date 2022/12/2 16:42
     * @param [id]
     * @return int
     */
    @ResponseBody
    @GetMapping("/updcommentpass")
    public int updcommentpass(Integer id){

        int i = commentlistService.updcommentpass(id);
        return i;
    }
    /**
     * @改成删除状态
     * @author Jin
     * @date 2022/12/2 16:43
     * @param [id]
     * @return int
     */
    @ResponseBody
    @GetMapping("/updcommentdel")
    public int updcommentdel(Integer id){

        int i = commentlistService.updcommentdel(id);
        return i;
    }
}
